// Notice.java
package com.community.model;

import java.time.LocalDateTime;

public class Notice {
    private Integer id;
    private String title;
    private String content;
    private LocalDateTime publishTime;

    public Notice() {}//无参构造方法

//全参构造方法：用于初始化公告的所有属性，方便一次性赋值。
    public Notice(Integer id, String title, String content, LocalDateTime publishTime) {
        this.id = id;
        this.title = title;
        this.content = content;
        this.publishTime = publishTime;
    }

    // Getters and Setters提供公共访问接口，允许外部访问和修改对象属性
    public Integer getId() { return id; }
    public void setId(Integer id) { this.id = id; }
    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }
    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }
    public LocalDateTime getPublishTime() { return publishTime; }
    public void setPublishTime(LocalDateTime publishTime) { this.publishTime = publishTime; }
//返回对象的字符串表示，便于调试和日志记录
    @Override
    public String toString() {
        return "Notice{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", publishTime=" + publishTime +
                '}';
    }
}